var _tools = require("../../../utils/tools.js"), _tools2 = _interopRequireDefault(_tools);

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var that, app = getApp();

Page({
    data: {
        num: 0,
        p: 1,
        isover: !1,
        navigation_list: []
    },
    onLoad: function(t) {
        that = this;
    },
    onReady: function() {
        that.loadContent();
    },
    onShow: function() {},
    onHide: function() {},
    gotoDetail: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/bh_rising/pages/newsDetail/newsDetail?id=" + a
        });
    },
    loadContent: function() {
        var t = {
            action: "index",
            contr: "news",
            token: wx.getStorageSync("token"),
            p: that.data.p
        };
        _tools2.default.request(t, function(t) {
            var a = t.info.news;
            0 == that.data.navigation_list.length && t.info.navigation_list && 0 < t.info.navigation_list.length && that.setData({
                navigation_list: t.info.navigation_list
            }), that.setData({
                config: t.info.config
            }), 1 < that.data.p && (a = that.data.data.concat(a)), that.setData({
                news: a
            }), t.info.news.length < 10 && that.setData({
                isover: !0
            });
        });
    },
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isover || (this.data.p += 1, that.loadContent());
    },
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_rising/pages/index/index?parent_id=" + this.data.share.member_id
        };
    }
});